#include <bits/stdc++.h>

using namespace std;

vector<vector<int>> subsetsWithDup(vector<int>& nums);

int main()
{
	return 0;
}

vector<vector<int>> subsetsWithDup(vector<int>& nums)
{
	vector<vector<int>> res;
	vector<int> layer;

	sort(nums.begin(), nums.end());
	unsigned length = nums.size();
	for (int bitmap = 0, max_len = 1 << length; bitmap < max_len; bitmap++) {
		layer.clear();
		bool isRepeat = false;

		if (bitmap & 1)
			layer.push_back(nums[0]);
		for (int idx = 1; idx < length; idx++)
			if (bitmap & 1 << idx) {
				if (nums[idx] == nums[idx - 1] && !(bitmap & 1 << idx - 1)) {
					isRepeat = true;
					break;
				}
				layer.push_back(nums[idx]);
			}

		if (!isRepeat)
			res.push_back(layer);
	}

	return res;
}
